import { NextFunction, Request } from 'express';
import { Method } from 'axios';
import { Response } from '../response';

export const crudMiddleware = async (req: Request, res: Response, next: NextFunction) => {
  const { originalUrl, baseUrl, method } = req as Request & { method: Method };
  const url = originalUrl.substring(baseUrl.length);
  const urlArr = url.split('/').slice(1);
  if (urlArr[0] === 'crud') {
    console.log('crud中间件');
  }
  // await sleep(4000)
  next();
};
